<template>
  <div class="select-table">
    <PageTable :columns="columns" :data="classifyTable" />
  </div>
</template>

<script>
import { mapMutations } from 'vuex'
export default {
  name: 'ClassifyTable',
  props: {
    classifyTable: Array
  },
  data() {
    return {
      columns: [
        {
          label: '一级分类',
          render: (h, { row }) => {
            return <div>{row.firstName}</div>
          }
        },
        {
          label: '二级分类',
          render: (h, { row }) => {
            return <div>{row.secondName || '-'}</div>
          }
        },
        {
          label: '推荐状态',
          render: (h, { row }) => {
            return <div>{row.isRecommend ? '推荐' : '不推荐'}</div>
          }
        },
        {
          label: '操作',
          render: () => {
            return (
              <PopConfirm text={'确认删除该分类吗？'} confirm={() => this.deleteClassfiy()}>
                <el-button type="text">删除</el-button>
              </PopConfirm>
            )
          }
        }
      ]
    }
  },
  methods: {
    ...mapMutations('base', ['RESET_POINT_SELECT']),
    deleteClassfiy() {
      this.RESET_POINT_SELECT()
    }
  }
}
</script>

<style lang="scss" scoped></style>
